package com.neuedu.dao.impl;

import com.neuedu.dao.UserDao;
import com.neuedu.model.User;
import com.neuedu.util.DBUtil;

import java.util.List;

public class UserDaoImpl implements UserDao {
    @Override
    public User selectUserByUnameAndPwd(String username, String password) {
        return DBUtil.findOneByWhere(User.class,"username=? and password=?" ,username,password);
    }

    @Override
    public User selectUserById(Integer id) {
        return DBUtil.findOneByWhere(User.class,"id=?",id);
    }

    @Override
    public Integer updateUserByIdSelective(User user) {
        return DBUtil.updateSelective(user,"id=?",user.getId());
    }


    @Override
    public List<User> selectAll() {

        return DBUtil.findAll(User.class);
    }
}
